package design_pattern.study.decorator;

public class Client {
    public static void main(String[] args) {
        FastFood fastFood = new FriedRice();//点一份炒饭
        //花费的价格
        System.out.println(fastFood.getDesc() + " " + fastFood.cost() + "元");

        //点一份加培根和鸡蛋的炒饭
        FastFood food1 = new FriedRice();
        Egg egg = new Egg(food1);
        Bacon bacon = new Bacon(egg);
        Egg egg1 = new Egg(bacon);//可以多重嵌套
        System.out.println(egg1.cost() + egg1.getDesc());
        //花费的价格
        System.out.println(bacon.getDesc() + " " + bacon.cost() + "元");

        //点一份加培根的炒面
        FastFood food2 = new FriedNoodles();
        Bacon bacon1 = new Bacon(food2);
        //花费的价格
        System.out.println(bacon1.getDesc() + " " + bacon1.cost() + "元");
    }
}
